package com.taxshare.manager.service;

import com.taxshare.manager.constant.UserConstant;
import com.taxshare.manager.mapper.CommAuthMapper;
import com.taxshare.response.beans.Response;
import com.taxshare.tools.constant.CommonConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: CommAuthService
 * @Description:
 * @author: luozhongyi
 * @date: 2021/4/13 10:52
 */
@Service
public class CommAuthService {

    @Autowired
    CommAuthMapper commAuthMapper;

    /**
     * 根据用户类型获取税号权限列表
     *
     * @param userid
     * @return
     */
    public Response<List<String>> getTaxNumbers(String userid, String userType) {
        if (UserConstant.USER_TYPE_1.equals(userType) || UserConstant.USER_TYPE_2.equals(userType)) {
            return Response.success(commAuthMapper.getTaxNumbers(userid));
        } else if (UserConstant.USER_TYPE_3.equals(userType)) {
            return Response.success(commAuthMapper.getAllTaxNumbers());
        } else {
            return Response.success(new ArrayList<String>());
        }
    }
}
